Search
woogc/checkout/single/split/trigger_email - WP Global Cart
16773
documentation-template-default,single,single-documentation,postid-16773,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive
 

woogc/checkout/single/split/trigger_email

WP Global Cart / woogc/checkout/single/split/trigger_email
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

woogc/checkout/single/split/trigger_email

Name: woogc/checkout/single/split/trigger_email
Type: Filter
Arguments: $status, $args

By default, WooCommerce will send appropriate email messages for every order. That may not be required in certain scenarios, so better control over the sent messages is necessary. This filter helps to manage those email messages programmatically.

For example, when check-out products from two other shops, disable the emails for the main order on the check-out:


    add_filter ( 'woogc/checkout/single/split/trigger_email', '__suppress_emails_for_main_order', 10, 2 );
    function __suppress_emails_for_main_order( $status, $args )
        {
            if ( $args['is_split_order']    === FALSE )   
                $status =   FALSE;
                
            return $status;
        }   

In the following example, the Customer receives email messages for the main order but not the split orders. The admin shops where a split order is created, continue to receive the new order message.


    add_filter ( 'woogc/checkout/single/split/trigger_email', '__enabled_emails_for_main_order', 10, 2 );
    function __enabled_emails_for_main_order( $status, $args )
        {
            //allow admin e-mails to get through
            if ( strpos( $args['email_object']->template_html, 'admin-' )   !== FALSE )
                return $status;
            
            if ( $args['is_split_order']    === TRUE )   
                $status =   FALSE;
                 
            return $status;
        }

The code should be placed inside a PHP file on /wp-content/mu-plugins folder.

0
Would love your thoughts, please comment.x
()
x